home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 10
/
AACD 10.iso
/
AACD
/
Programming
/
AmigaTalk
/
Intuition
/
MyGadgets.st
< prev
next >
Wrap
Text File
|
2000-02-16
|
10KB
|
249 lines
"-------------------------------------------------------"
" PushButton Class is a custom look for boolean gadgets."
"-------------------------------------------------------"
Class PushButton :BoolGadget ! renderName selectName !
[
" gadgetValues is an Array with the following fields:
NextGadget, LeftEdge, TopEdge, Width, Height, Flags,
Activation, GadgetType, GadgetText, GadgetID:
"
initialize: gadgetName withArray: gadgetValues
! ng le te w h f a gt gr sr txt id tb1 tb2 a1 a2 a3 a4 !
ng <- gadgetValues at: 1.
le <- gadgetValues at: 2.
te <- gadgetValues at: 3.
w <- gadgetValues at: 4.
h <- gadgetValues at: 5.
f <- gadgetValues at: 6.
a <- gadgetValues at: 7.
gt <- gadgetValues at: 8.
txt <- gadgetValues at: 9.
id <- gadgetValues at: 10.
a1 <- Array new: 12.
a2 <- Array new: 8.
a3 <- Array new: 12.
a4 <- Array new: 8.
gr <- Border new.
sr <- Border new.
tb1 <- Border new.
tb2 <- Border new.
a1 at: 1 put: 0; at: 2 put: h; at: 3 put: 0; at: 4 put: 0.
a1 at: 5 put: w; at: 6 put: 0; at: 7 put: (w - 1); at: 8 put: 1.
a1 at: 9 put: 1; at: 10 put: 1; at: 11 put: 1; at: 12 put: (h - 1).
a2 at: 1 put: 0; at: 2 put: 0; at: 3 put: 2; at: 4 put: 0.
a2 at: 5 put: 0; at: 6 put: 6; at: 7 put: a1; at: 8 put: 'NULL'.
tb1 initialize: 'tb1' withArray: a2.
a3 at: 1 put: w; at: 2 put: 0; at: 3 put: w; at: 4 put: h.
a3 at: 5 put: 0; at: 6 put: h; at: 7 put: 1; at: 8 put: (h - 1).
a3 at: 9 put: (w - 1); at: 10 put: (h - 1); at: 11 put: (w - 1); at: 12 put: 0.
a4 at: 1 put: 0; at: 2 put: 0; at: 3 put: 1; at: 4 put: 0.
a4 at: 5 put: 0; at: 6 put: 6; at: 7 put: a3; at: 8 put: 'tb1'.
gr initialize: (gadgetName,'Bdr1') withArray: a4.
"
tb2 initialize: 'tb2' withArray: #( 0 0 1 0 0 6
(0 h 0 0 w 0 (w-1) 1 1 1 1 (h-1))
'NULL' ).
sr initialize: (gadgetName,'Bdr2')
withArray: #( 0 0 2 0 0 6
(w 0 w h 0 h 1 (h-1) (w-1) (h-1) (w-1) 0)
'tb2' ).
"
gt <- ((gt bitAnd: 16rF0F0) + 1). "Set BOOLGADGET type."
f <- ((f bitAnd: 16rFFF0) + 2). "Set GADGHIMAGE flag."
renderName <- gr.
selectName <- sr.
super initialize: gadgetName
withArray: #(ng le te w h f a gt gr sr txt id)
]
"-----------------------------------------------------"
" TextField Class is a custom look for string gadgets."
"-----------------------------------------------------"
Class TextField :StrGadget ! renderName selectName !
[
" gadgetValues is an Array with the following fields:
NextGadget, LeftEdge, TopEdge, Width, Height, Flags,
Activation, GadgetType, GadgetText, GadgetID, BufferSize:
"
initialize: gadgetName withArray: gadgetValues
! ng le te w h f a gt gr sr txt id bs tb1 tb2 !
ng <- gadgetValues at: 1.
le <- gadgetValues at: 2.
te <- gadgetValues at: 3.
w <- gadgetValues at: 4.
h <- gadgetValues at: 5.
f <- gadgetValues at: 6.
a <- gadgetValues at: 7.
gt <- gadgetValues at: 8.
txt <- gadgetValues at: 9.
id <- gadgetValues at: 10.
bs <- gadgetValues at: 11.
gr <- Border new.
sr <- Border new.
tb1 <- Border new.
tb2 <- Border new.
tb1 initialize: 'tb1' withArray: #( 0 0 2 0 0 6
(0 h 0 0 w 0 (w-1) 1 1 1 1 (h-1))
'NULL' ).
gr initialize: (gadgetName,'Bdr1')
withArray: #( 0 0 1 0 0 6
(w 0 w h 0 h 1 (h-1) (w-1) (h-1) (w-1) 0)
'tb1' ).
tb2 initialize: 'tb2' withArray: #( 0 0 1 0 0 6
(0 h 0 0 w 0 (w-1) 1 1 1 1 (h-1))
'NULL' ).
sr initialize: (gadgetName,'Bdr2')
withArray: #( 0 0 2 0 0 6
(w 0 w h 0 h 1 (h-1) (w-1) (h-1) (w-1) 0)
'tb2' ).
((a bitAnd: 16r0F00) == 16r0800) "Is this an Integer Field?"
ifFalse: [a <- ((a bitAnd: 16rF0FF) + 16r200)]. "No, center string."
gt <- ((gt bitAnd: 16rF0F0) + 4). "Set STRGADGET type."
f <- ((f bitAnd: 16rFFF0) + 2). "Set GADGHIMAGE flag."
renderName <- gr.
selectName <- sr.
super initialize: gadgetName
withArray: #(ng le te w h f a gt gr sr txt id bs)
]
"------------------------------------------------------------"
" VertSlider Class is a custom look for proportional gadgets."
"------------------------------------------------------------"
Class VertSlider :PropGadget ! renderName selectName !
[
" gadgetValues is an Array with the following fields:
NextGadget, LeftEdge, TopEdge, Width, Height, Flags,
Activation, GadgetType, GadgetText, GadgetID, PropFlags,
VertPot, VertBody:
"
initialize: gadgetName withArray: gadgetValues
! ng le te w h f a gt gr sr txt id pf vp vb tb1 tb2 !
ng <- gadgetValues at: 1.
le <- gadgetValues at: 2.
te <- gadgetValues at: 3.
w <- gadgetValues at: 4.
h <- gadgetValues at: 5.
f <- gadgetValues at: 6.
a <- gadgetValues at: 7.
gt <- gadgetValues at: 8.
txt <- gadgetValues at: 9.
id <- gadgetValues at: 10.
pf <- gadgetValues at: 11.
vp <- gadgetValues at: 12.
vb <- gadgetValues at: 13.
gr <- Border new.
sr <- Border new.
tb1 <- Border new.
tb2 <- Border new.
tb1 initialize: 'tb1' withArray: #( 0 0 2 0 0 6
(0 h 0 0 w 0 (w-1) 1 1 1 1 (h-1))
'NULL' ).
gr initialize: (gadgetName,'Bdr1')
withArray: #( 0 0 1 0 0 6
(w 0 w h 0 h 1 (h-1) (w-1) (h-1) (w-1) 0)
'tb1' ).
tb2 initialize: 'tb2' withArray: #( 0 0 1 0 0 6
(0 h 0 0 w 0 (w-1) 1 1 1 1 (h-1))
'NULL' ).
sr initialize: (gadgetName,'Bdr2')
withArray: #( 0 0 2 0 0 6
(w 0 w h 0 h 1 (h-1) (w-1) (h-1) (w-1) 0)
'tb2' ).
pf <- ((pf bitAnd: 16rFFF9) + 4). "Set FREEVERT flag."
gt <- ((gt bitAnd: 16rF0F0) + 3). "Set PROPGADGET type."
f <- ((f bitAnd: 16rFFF0) + 2). "Set GADGHIMAGE flag."
renderName <- gr.
selectName <- sr.
super initialize: gadgetName
withArray: #(ng le te w h f a gt gr sr txt id pf 0 vp 0 vb)
|
setProp: gadgetName flags: newFlags vPot: vp vBody: vb
newFlags <- ((newFlags bitAnd: 16rFFF9) + 4). "Set FREEVERT flag."
super setProps: gadgetName flags: newFlags
hPot: 0 vPot: vp hBody: 0 vBody: vb
]
"-------------------------------------------------------------"
" HorizSlider Class is a custom look for proportional gadgets."
"-------------------------------------------------------------"
Class HorizSlider :PropGadget ! renderName selectName !
[
" gadgetValues is an Array with the following fields:
NextGadget, LeftEdge, TopEdge, Width, Height, Flags,
Activation, GadgetType, GadgetText, GadgetID, PropFlags,
HorizPot, HorizBody:
"
initialize: gadgetName withArray: gadgetValues
! ng le te w h f a gt gr sr txt id pf hp hb tb1 tb2 !
ng <- gadgetValues at: 1.
le <- gadgetValues at: 2.
te <- gadgetValues at: 3.
w <- gadgetValues at: 4.
h <- gadgetValues at: 5.
f <- gadgetValues at: 6.
a <- gadgetValues at: 7.
gt <- gadgetValues at: 8.
txt <- gadgetValues at: 9.
id <- gadgetValues at: 10.
pf <- gadgetValues at: 11.
hp <- gadgetValues at: 12.
hb <- gadgetValues at: 13.
gr <- Border new.
sr <- Border new.
tb1 <- Border new.
tb2 <- Border new.
tb1 initialize: 'tb1' withArray: #( 0 0 2 0 0 6
(0 h 0 0 w 0 (w-1) 1 1 1 1 (h-1))
'NULL' ).
gr initialize: (gadgetName,'Bdr1')
withArray: #( 0 0 1 0 0 6
(w 0 w h 0 h 1 (h-1) (w-1) (h-1) (w-1) 0)
'tb1' ).
tb2 initialize: 'tb2' withArray: #( 0 0 1 0 0 6
(0 h 0 0 w 0 (w-1) 1 1 1 1 (h-1))
'NULL' ).
sr initialize: (gadgetName,'Bdr2')
withArray: #( 0 0 2 0 0 6
(w 0 w h 0 h 1 (h-1) (w-1) (h-1) (w-1) 0)
'tb2' ).
pf <- ((pf bitAnd: 16rFFF9) + 2). "Set FREEHORIZ flag."
gt <- ((gt bitAnd: 16rF0F0) + 3). "Set PROPGADGET type."
f <- ((f bitAnd: 16rFFF0) + 2). "Set GADGHIMAGE flag."
renderName <- gr.
selectName <- sr.
super initialize: gadgetName
withArray: #(ng le te w h f a gt gr sr txt id pf hp 0 hb 0)
|
setProp: gadgetName flags: newFlags hPot: hp hBody: hb
newFlags <- ((newFlags bitAnd: 16rFFF9) + 2). "Set FREEHORIZ flag."
super setProps: gadgetName flags: newFlags
hPot: hp vPot: 0 hBody: hb vBody: 0
]